{extend name='public/content'}

{block name="title"}
	退款退货
{/block}

{block name="body"}
<div class="layui-container" ng-app="myApp" ng-controller="myCtrl">  

		  <div class="layui-row"  ng-repeat="x in shuju">
		    <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
		    名称	{{x.good.name}}
		    </div>
		    <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
		    	<img style="width: 100px;height: 100px" ng-src="{{x.good.logo}}" alt="">
		    </div>
		    <div class="layui-col-xs4 layui-col-sm12 layui-col-md4">
		     	{{x.good.description}}
		    </div>
		    <div class="layui-col-xs4 layui-col-sm7 layui-col-md8">
		    	数量{{x.goods_num}}
		    </div>
		    <div class="layui-col-xs4 layui-col-sm5 layui-col-md4">
		   	   总价{{x.signal_price}} 
		    </div>
		    <div ng-if="x.is_tuihuo==1" ng-show="true" class="layui-col-xs4 layui-col-sm5 layui-col-md4 layui-btn layui-btn-sm layui-btn-normal"><a href="">已申请了退款</a></div>
		    <div ng-if="x.is_tuihuo==1" ng-show="true" ng-click="caclefeedback(this)" class="layui-col-xs4 layui-col-sm5 layui-col-md4 layui-btn layui-btn-sm layui-btn-normal">取消退款</div>
		 	<div ng-if="x.is_tuihuo==0" ng-show="true" class="layui-col-xs4 layui-col-sm5 layui-col-md4 layui-btn layui-btn-sm layui-btn-normal"><a href="{:url('index/order/goodbackorderdertail')}?id={{x.id}}">退款</a></div>
		  </div>
		</div>	

{/block}

{block name="script"}
	<script type="text/javascript">
		require(['jquery','angular'], function ($,angljs) { 
			var app = angular.module('myApp', []);
			app.service('$factory',function($http){
				var locg={
		   			caclfeed:function($id,call){
		   				var url ="{:url('order/caclfeed')}?id="+$id ;
	                 	$http.get(url,{}).then(function(res){call(res)})	
		   			}
		   		}
		   		return locg;
			})
			app.controller('myCtrl', function($scope, $http,$factory) {
				 $http({
				        method: 'GET',
				        url: "{:url('order/goodbackapi')}?id={$id}"
				    }).then(function successCallback(response) {
				        $scope.shuju = response.data.detaile;
				      
				    })

				   $scope.caclefeedback=function(x){
			   		 $factory.caclfeed($scope.shuju[x.$parent.$index].id,function(data){
			   		 	if(data.data==1){
			   		 		  $scope.shuju[x.$parent.$index].is_tuihuo=0;
			   		 	}
			   		 })
				   }

			})

		})
	</script>
 	
{/block}
	
{block name="style"}
 <style type="text/css">
 	
 </style>
{/block}
